/*
 ============================================================================
 Name		: Flashbox4AppView.h
 Author	  : ceze
 Copyright   : FlashBox for ver.Zhongyou(???)
 Description : 主界面容器
 ============================================================================
 */

#ifndef __FLASHBOX4APPVIEW_h__
#define __FLASHBOX4APPVIEW_h__

// INCLUDES
#include <coecntrl.h>
#include "fbtabgrouptop.h"
#include "fbtabobserver.h"
#include "FbContentWindow.h"
#include "FbSoftKeyBar.h"
#include "FbInformation.h"
#include "Flashbox4.hrh"

#define ADD_OPTION


// CLASS DECLARATION
class CFlashbox4MainContainer : public CCoeControl,
		MFbTabObserver,
		MListObserver,
		MSoftKeyObserver
{
	// friend classes
	friend class CFbContentWindow;
	
public:
	/**
	 * ~CFlashbox4AppView
	 * Virtual Destructor.
	 */
	virtual ~CFlashbox4MainContainer ();

	/**
	 * ConstructL
	 * 2nd phase constructor.
	 * Perform the second phase construction of a
	 * CFlashbox4AppView object.
	 * @param aRect The rectangle this view will be drawn to.
	 */
	void ConstructL (const TRect& aRect, TInt aActiveTabIndex);

public:
	// Functions from base classes

	/**
	 * From CCoeControl, Draw
	 * Draw this CFlashbox4AppView to the screen.
	 * @param aRect the rectangle of this view that needs updating
	 */
	void Draw (const TRect& aRect ) const;

	/**
	 * From CoeControl, SizeChanged.
	 * Called by framework when the view size is changed.
	 */
	virtual void SizeChanged ();

	/**
	 * From CoeControl,CountComponentControls.
	 */
	TInt CountComponentControls () const;

	/**
	 * From CCoeControl,ComponentControl.
	 */
	CCoeControl* ComponentControl (TInt aIndex ) const;

	/**
	 * From CoeControl,
	 * 按键事件接收处理
	 */
	TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType );

	/**
	 * 设置软键softkeybar选项
	 */
	void SetSoftKeyBarL(const TInt aTypeIndex, TBool aDrawNow = ETrue);
	
protected:
	/**
	 * 派生自MFbTabObserver接口
	 * 处理tab切换事件
	 */
	void TabChangedL (TInt aTabIndex, TInt aTabId );

	/**
	 * 派生自SoftKeyBar
	 */
	void SoftKeyEvent (TInt aKeyId );

	/**
	 * 初始化Tabgroup
	 */
	void InitializeTabGroupL (CFbTabgroupTop *pTabgroup );

	/**
	 * from MListObserver
	 * pHandle 发出消息的对象
	 * aItemIndex:激活的item 序号
	 * aEventType:事件类型
	 */
	void ListItemEvent (CFbList *pHandle, TInt aItemIndex,TInt aItemId, TInt aEventType );

	/**
	 * 进入不可用状态(半透明)
	 */
	void SetDimmed(TBool aDimmed);
	
private:
	CFbTabgroupTop *m_pTopTabgroup;
	CFbContentWindow *m_pContentWindow;
	//软键区
	CFbSoftKeyBar *m_pSoftKeyBar;

	CFbList *m_pOptionList;//选项菜单列表
	CFbInformation *m_pOptInfo;//帮助或关于页面信息
	
	TInt m_CurrentPageLevel;//当前页面级数
	
	CFbList *m_pEjectOption;//屏保和来电Table的弹出菜单
	
	void InitialEjectOption();//Initialize the EjectOption (For Pingbao & Laidian page)
	
	void UpdateEjectOption(TContentsType aCategoryType);//change the EjectOption for Pingbao or laidian
	
	void SetSelectedFile(TContentsType aCategoryType, TInt aItemIndex);//Set the file you selected to Pingbao or laidian
	
	void UpdateEjectOptionRectPos();
	
#ifdef ADD_OPTION
	void InitialOption();
	
	void MakeAllVisableExceptOpt(TBool bEnable);
	
	void UpdateOption(TOptionType aPageId);//参数说明aPageId，根据页面号来确定选择内容！
	
#endif
	
};

#endif // __FLASHBOX4APPVIEW_h__
// End of File
